package xin.marcher.module.common.enums.construction;

import java.util.HashMap;
import java.util.Map;

/**
 *
 */
public enum AuditCustomTypeEnum {

    /**
     * item
     */
    ITEM(1, "item"),

    /**
     * sku
     */
    SKU(2, "sku"),

    /**
     * 品类
     */
    CATEGORY(3, "品类");

    private Integer code;

    private String value;

    AuditCustomTypeEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> map = new HashMap<>(16);
        for (AuditCustomTypeEnum element : AuditCustomTypeEnum.values()) {
            map.put(element.getCode(), element.getValue());
        }
        return map;
    }

    public static AuditCustomTypeEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (AuditCustomTypeEnum element : AuditCustomTypeEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }

}
